package com.acme.bankapp.domain.bank.exception;

/**
 * Exception thrown, when there is no enough funds to make a withdrawal.
 * 
 */
@SuppressWarnings("serial")
public class NotEnoughFundsException extends BankException {
	private final double amount;

	/**
	 * Creates not enough funds exception.
	 * 
	 * @param message
	 *            detail error message
	 * @param amount
	 *            insufficient amount
	 */
	public NotEnoughFundsException(String message, double amount) {
		super(message);
		this.amount = amount;
	}

	/**
	 * Creates not enough funds exception.
	 * 
	 * @param amount
	 *            insufficient amount
	 */
	public NotEnoughFundsException(double amount) {
		this("Account has no enough funds. Insufficient amount: $" + amount
				+ ".", amount);
	}

	/**
	 * Returns insufficient amount.
	 * 
	 * @return insufficient amount
	 */
	public double getInsufficientAmount() {
		return amount;
	}
}